home *** CD-ROM | disk | FTP | other *** search
/ Run Magazine ReRun: Productivity Pak 1 / rerun-productivity-pak-i.d64 / finance aid (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  8KB  |  283 lines

  1. 1 rem*******************
  2. 2 rem home finance aid
  3. 3 rem*******************
  4. 40 print"[147]"chr$(14): rem set upper/lower case
  5. 50 sc=53281:bc=53280: rem screen color address, border color address
  6. 60 am=0:ir=0:ny=0: rem amount, interest rate, # of years
  7. 65 py=0:vy=0: rem # of payments, investments per year
  8. 70 gosub9000: rem set sound parameters
  9. 75 ll$="": rem last line
  10. 80 gosub9300: rem print instructions
  11. 100 rem************
  12. 101 rem main menu
  13. 102 rem************
  14. 105 print"[147]";:pokesc,7:pokebc,7
  15. 107 printtab(3)"                                 "
  16. 110 printtab(3)" [200][160][207][160][205][160][197][160][160][160][198][160][201][160][206][160][193][160][206][160][195][160][197]   [193][160][201][160][196] "
  17. 115 printtab(3)"                                 "
  18. 120 printtab(4)"[151]f1[146]-[196]etermine [208]ayment for a loan"
  19. 140 printtab(4)"f3[146]-[195]alculate [198]uture [214]alue of an"
  20. 150 printtab(7)"[201]nvestment"
  21. 170 printtab(4)"f5[146]-[195]alculate [198]uture [214]alue of an"
  22. 180 printtab(7)"[197]qual [208]eriodic [201]nvestment"
  23. 190 printtab(4)"[151]f6[146]-[208]rint [200]ardcopy [201]mage of"
  24. 195 printtab(7)"[195]urrent [211]creen"
  25. 200 printtab(4)"f7[146]-[197]nd"
  26. 210 geto$:ifo$=""then210
  27. 220 ifo$=chr$(133)thengosub9100:gosub1000:goto100
  28. 230 ifo$=chr$(134)thengosub9100:gosub2000:goto100
  29. 240 ifo$=chr$(135)thengosub9100:gosub3000:goto100
  30. 245 ifo$=chr$(139)thengosub9100:gosub60000:goto100
  31. 250 ifo$=chr$(136)thengosub9100:print"[147]":end
  32. 260 gosub9200
  33. 270 goto210
  34. 1000 print"[147]";:pokesc,11:pokebc,3
  35. 1005 printll$tab(28)"[158]f7[146]-[205]enu"
  36. 1010 printtab(6)"[158][196][197][212][197][210][205][201][206][197][160][208][193][217][205][197][206][212][160][198][207][210][160][193][160][204][207][193][206]"
  37. 1030 printtab(13)"[158][204]oan [193]mount ";
  38. 1035 n=am:gosub8000
  39. 1040 ifd$=chr$(136)thenreturn
  40. 1045 am=n
  41. 1050 printtab(4)"[158][193]nnual [201]nterest [210]ate ";
  42. 1055 n=ir:gosub8000
  43. 1060 ifd$=chr$(136)thenreturn
  44. 1065 ir=n
  45. 1080 printtab(9)"[158][206]umber of [217]ears ";
  46. 1085 n=ny:gosub8000
  47. 1090 ifd$=chr$(136)thenreturn
  48. 1095 ny=n
  49. 1100 printtab(7)"[158][208]ayments per [217]ear ";
  50. 1105 n=py:gosub8000
  51. 1110 ifd$=chr$(136)thenreturn
  52. 1115 py=n
  53. 1130 i=ir/py/100
  54. 1135 ifi=0theni=1
  55. 1140 ca=am/((1-1/(1+i)^(py*ny))/i)
  56. 1150 printtab(10)"[158][208]ayment [193]mount[153]";:n=ca:gosub8300
  57. 1160 printtab(11)"[158][201]nterest [208]aid[153]";:n=(ca*py*ny)-am:gosub8300
  58. 1170 printll$tab(5)"[158]f1[146]-[193]gain  f6[146]-[200]ardcopy  f7[146]-[205]enu"
  59. 1180 geto$:ifo$=""then1180
  60. 1190 ifo$=chr$(133)thengosub9100:goto1000
  61. 1195 ifo$=chr$(139)thengosub9100:gosub60000:goto1180
  62. 1200 ifo$=chr$(136)thengosub9100:return
  63. 1210 gosub9200:goto1180
  64. 2000 print"[147]":pokesc,12:pokebc,12
  65. 2005 printll$tab(28)"f7[146]-[205]enu"
  66. 2010 printtab(9)"[144][195][193][204][195][213][204][193][212][197][160][198][213][212][213][210][197][160][214][193][204][213][197]"
  67. 2020 printtab(12)"[207][198][160][193][206][160][201][206][214][197][211][212][205][197][206][212]"
  68. 2030 printtab(12)"[201]nvestment [193]mount ";
  69. 2035 n=am:gosub8000
  70. 2040 ifd$=chr$(136)thenreturn
  71. 2045 am=n
  72. 2060 printtab(9)"[193]nnual [201]nterest [210]ate ";
  73. 2075 n=ir:gosub8000
  74. 2080 ifd$=chr$(136)thenreturn
  75. 2085 ir=n
  76. 2090 printtab(14)"[206]umber of [217]ears ";
  77. 2095 n=ny:gosub8000
  78. 2100 ifd$=chr$(136)thenreturn
  79. 2105 ny=n
  80. 2110 printtab(4)"[201]nterest [208]eriods per [217]ear ";
  81. 2115 n=py:gosub8000
  82. 2120 ifd$=chr$(136)thenreturn
  83. 2125 py=n
  84. 2140 i=ir/py/100
  85. 2150 ca=am*((1+i)^(py*ny))
  86. 2160 printtab(17)"[198]uture [214]alue[158]";:n=ca:gosub8300
  87. 2180 printtab(14)"[201]nterest [197]arned[158]";:n=ca-am:gosub8300
  88. 2190 printll$tab(5)"f1[146]-[193]gain  f6[146]-[200]ardcopy  f7[146]-[205]enu"
  89. 2200 geto$:ifo$=""then2200
  90. 2210 ifo$=chr$(133)thengosub9100:goto2000
  91. 2215 ifo$=chr$(139)thengosub9100:gosub60000:goto2200
  92. 2220 ifo$=chr$(136)thengosub9100:return
  93. 2230 gosub9200:goto2200
  94. 3000 print"[147]":pokesc,4:pokebc,4
  95. 3005 printll$tab(28)"[144]f7[146]-[205]enu"
  96. 3010 printtab(3)"[144][195][193][204][195][213][204][193][212][197][160][198][213][212][213][210][197][160][214][193][204][213][197] [207][198][160][193][206][160][197][209][213][193][204]"
  97. 3020 printtab(10)"[208][197][210][201][207][196][201][195][160][201][206][214][197][211][212][205][197][206][212]"
  98. 3030 printtab(12)"[144][201]nvestment [193]mount ";
  99. 3035 n=am:gosub8000
  100. 3040 ifd$=chr$(136)thenreturn
  101. 3045 am=n
  102. 3060 printtab(9)"[144][193]nnual [201]nterest [210]ate ";
  103. 3065 n=ir:gosub8000
  104. 3070 ifd$=chr$(136)thenreturn
  105. 3075 ir=n
  106. 3090 printtab(14)"[144][206]umber of [217]ears ";
  107. 3095 n=ny:gosub8000
  108. 3100 ifd$=chr$(136)thenreturn
  109. 3105 ny=n
  110. 3110 printtab(9)"[144][201]nvestments per [217]ear ";
  111. 3115 n=vy:gosub8000
  112. 3120 ifd$=chr$(136)thenreturn
  113. 3125 vy=n
  114. 3140 printtab(4)"[144][201]nterest [208]eriods per [217]ear ";
  115. 3145 n=py:gosub8000
  116. 3150 ifd$=chr$(136)thenreturn
  117. 3155 py=n
  118. 3170 i=ir/py/100
  119. 3180 ifvy>=pythenca=(am*(vy/py))*((((1+i)^(py*ny+1)-1)/i)-1)
  120. 3190 ifvy<pythengosub3500
  121. 3200 printtab(11)"[144][193]mount [201]nvested[158]";:n=am*vy*ny:gosub8300
  122. 3210 printtab(14)"[144][198]uture [214]alue[158]";:n=ca:gosub8300
  123. 3230 printtab(11)"[144][201]nterest [197]arned[158]";:n=ca-(am*vy*ny):gosub8300
  124. 3240 printll$tab(5)"[144]f1[146]-[193]gain  f6[146]-[200]ardcopy  f7[146]-[205]enu"
  125. 3250 geto$:ifo$=""then3250
  126. 3260 ifo$=chr$(133)thengosub9100:goto3000
  127. 3265 ifo$=chr$(139)thengosub9100:gosub60000:goto3250
  128. 3270 ifo$=chr$(136)thengosub9100:return
  129. 3280 gosub9200:goto3250
  130. 3500 ca=am:x=1:ms=-1
  131. 3505 tm$=ti$
  132. 3510 form=0to((py*ny)-1)
  133. 3520 ca=ca*(1+i)
  134. 3530 ifint(m*(vy/py))=xthenca=ca+am:x=x+1
  135. 3540 iftm$=ti$thennext:ms=0
  136. 3550 ifms=-1thenprinttab(8)" [195]alculation in [208]rocess [145]"
  137. 3560 ifms=1thenprinttab(8)"                        [145]"
  138. 3570 ms=ms*(-1)
  139. 3580 tm$=ti$
  140. 3585 ifms<>0thennext
  141. 3587 printtab(8)"                        [145]"
  142. 3590 return
  143. 8000 rem************************
  144. 8001 rem get numeric value in n
  145. 8002 rem************************
  146. 8005 sd$="y": rem decimal point switch
  147. 8010 n$=""  : rem number string
  148. 8015 x=0:ms=1: rem flash cursor counter and switch
  149. 8020 getd$:ifd$<>""thenprint" [157]";:goto8045
  150. 8025 x=x+1:ifx<>15then8020
  151. 8030 ifms=1thenprint" [157][146]";
  152. 8035 ifms=-1thenprint" [157]";
  153. 8040 ms=ms*-1:x=0:goto8020
  154. 8045 ifd$=chr$(20)thengosub8400:goto8020
  155. 8050 ifd$=chr$(136)thengosub9100:return
  156. 8055 ifd$=chr$(13)andn$=""then8150
  157. 8060 ifd$=chr$(13)then8200
  158. 8065 ifd$<>"."and(d$<"0"ord$>"9")thengosub9200:goto8020
  159. 8070 ifd$="."andsd$="n"thengosub9200:goto8020
  160. 8080 ifd$="."thensd$="n"
  161. 8085 iflen(n$)=9thengosub9200:goto8020
  162. 8090 printd$;
  163. 8100 gosub9100
  164. 8110 n$=n$+d$
  165. 8120 goto8020
  166. 8150 rem*********************
  167. 8151 rem use previous value
  168. 8152 rem*********************
  169. 8160 n$=right$(str$(n),(len(str$(n))-1))
  170. 8170 printn$;
  171. 8200 rem*********************************************************
  172. 8201 rem if value is zero, display message and go back for data
  173. 8202 rem*********************************************************
  174. 8210 ifval(n$)<>0thenn=val(n$):print:gosub9100:return
  175. 8220 print"[218]ero is invalid[146]";:gosub9200
  176. 8230 form=1to1000:next
  177. 8240 print"[157][157][157][157][157][157][157][157][157][157][157][157][157][157][157]               ";
  178. 8250 print"[157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157]";
  179. 8260 goto8020
  180. 8300 rem************************************
  181. 8301 rem round n to nearest cent and print
  182. 8302 rem************************************
  183. 8310 ifn<.005thenprint" .00":return
  184. 8320 n$=str$(n+.005)
  185. 8330 x=1
  186. 8340 ifmid$(n$,x,1)<>"."thenx=x+1:ifx<8then8340
  187. 8350 printleft$(n$,(x+2))
  188. 8360 return
  189. 8400 rem************************************
  190. 8401 rem delete previous character routine
  191. 8402 rem************************************
  192. 8405 ifn$=""thengosub9200:goto8490
  193. 8410 gosub9100
  194. 8420 print"[157][160][157]";
  195. 8425 ifright$(n$,1)="."thensd$="y"
  196. 8430 n$=left$(n$,(len(n$)-1))
  197. 8490 return
  198. 9000 rem***********************
  199. 9001 rem set sound parameters
  200. 9002 rem***********************
  201. 9010 s=54272
  202. 9015 forx=0to24
  203. 9020 pokes+x,0: rem clear sid registers
  204. 9025 next
  205. 9030 pokes+0,135: rem set voice